<?php echo $header; ?>
		<div id="main">
                        	
                            <!-- Begin main-content  -->
                            <div class="no-sidebar fl-left" id="content">
                            	<!-- Breadcumbs  -->
                            	<div class="fl-left" id="breadcumbs">
                                	<ul id="crumbs">
                                        <li><a href=".">Trang chủ</a></li>
                                        <li><span>Đặt hàng trực tuyến</span></li>
                                    </ul>
                                </div>
                                <!-- /Breadcumbs  -->
                                
                                <!-- Payment login and register-->
                                <div class="order-process">
                                  <h1 class="tt-h1">Đặt hàng trực tuyến</h1>
                                  <div class="w500 fl-left">
                                  	<div class="client-info">
                                        <h3>Thông tin Quý khách</h3>
                                        <p><span><?php echo $addresse['firstname'];?></span>Họ tên Qúy khách:</p>
                                        <p><span><?php echo $this->customer->getUserName();?></span>Tài khoản:</p>
                                        <p>Mật khẩu:<a href="<?php echo $this->url->link('common/password','onlinepay=true');?>">Thay đổi password</a></p>
                                        <p><span><?php echo $this->customer->getEmail();?></span>Email:</p>
                                        <p><span><?php echo $this->customer->getTelephone();?></span>Điện thoại:</p>
                                        <p><span><?php echo $addresse['address_1'];?></span>Địa chỉ:</p>
                                        <p><span><?php echo $addresse['address_2'];?></span>Phường/Xã:</p>
                                        <p><span><?php echo $addresse['city'];?></span>Quận/Huyện:</p>
                                        <p><span><?php echo $addresse['zone'];?></span>Thành phố:</p>
                                    </div>
                                    <div class="register-form">
                                    
                                            <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="shippingUserForm">
                                            <fieldset>
                                                    
                                                    
                                                  
                                                    <a href="javascript:toggleDiv('otherAddress');" class="address-switch" style="margin-left:0px;">Giao hàng đến địa chỉ khác của qúy khách</a>
                                                    
                                                    <div style="display: none;" class="input-set pdb10" id="otherAddress">
                                                    <?php
                                    if ($error || ($isshipping==1)) {
                                    
                                    ?>
                                    <script>
									$(function () {
                                 	   toggleDiv('otherAddress'); 
									});
                                    </script>
                                    <p class="message warning" style="<?php if(!$error) echo 'display:none;';?>" >Xin vui lòng điền những trường thông tin có đánh dấu <span class="red">*</span> 
                                        
                                        <?php if ($error_shipping_firstname) { ?>
                                            <br/><?php echo $error_shipping_firstname; ?>
                                        <?php } ?>
                                         <?php if ($error_email) { ?>
                                         <br/><?php echo $error_email; ?>
                                         <?php } ?>
                                        
                                         <?php if ($error_shipping_telephone) { ?>
                                         <br/><?php echo $error_shipping_telephone; ?>
                                         <?php } ?>
                                         <?php if ($error_shipping_address_1) { ?>
                                         <br/><?php echo $error_shipping_address_1; ?>
                                         <?php } ?>
                                         <?php if ($error_shipping_address_2) { ?>
                                         <br/><?php echo $error_shipping_address_2; ?>
                                         <?php } ?>
                                         <?php if ($error_shipping_city) { ?>
                                         <br/><?php echo $error_shipping_city; ?>
                                         <?php } ?>
                                         
                                    </p>
                                     <?php } ?>
                                                        <label>Họ tên qúy khách<span class="red">*</span></label>
                                                        <input type="text" value="<?php echo $shipping_firstname; ?>"  name="shipping_firstname">
                                                        <label style="display:none" >Điện thoại <span class="red">*</span></label>
                                                        <input style="display:none"  type="text" value="999999999" name="shipping_telephone" >
                                                        <label>Địa chỉ <span class="red">*</span></label>
                                                        <input type="text" value="<?php echo $shipping_address_1; ?>" name="shipping_address_1">
                                                        <label>Phường/Xã <span class="red">*</span></label>
                                                        <input type="text" value="<?php echo $shipping_address_2; ?>" name="shipping_address_2">
                                                        <label>Quận/Huyện <span class="red">*</span></label>
                                                        <input type="text" value="<?php echo $shipping_city; ?>" name="shipping_city">
                                                        <label>Tỉnh/Thành phố <span class="red">*</span></label>
                                                        <select name="shipping_zone_id"></select>
                                                        <input type="hidden" value="230" name="shipping_country_id" /> 
                                                        <input type="hidden" name="shipping_lastname" value="lastname" />
                                                        <input type="hidden" name="shipping_postcode" value="post" />
                                                       <input type="hidden" name="company" value="company" />
                                                       <input type="hidden" id="isshipping" name="isshipping" value="0" />
                                                    </div>
                                                   
                                                    
                                                    
                                                </fieldset>
                                            </form>
                                        </div>
                                    <h1 class="tt-h1">Đơn hàng của Quý khách </h1>
                                    <div class="cart-info">
                                    	
                                    	<table cellspacing="0" cellpadding="0" class="purchase">
                                            <tbody>
                                                <tr class="first">
                                                    <th class="first">Hình ảnh</th>
                                                    <th width="300" class="left">Sản phẩm</th>
                                                    <th>Số lượng</th>
                                                    <th width="100">Giá (VND)</th>
                                                    <th width="148" class="right">Thành tiền (VND)</th>
                                                </tr>
                                                <?php foreach ($products as $product) { ?>
                                    <tr class="odd">
                                    	
                                        <td class="prd-img">
                                        <?php if ($product['thumb']) { ?>
                                        <img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" title="<?php echo $product['name']; ?>" />
                                        <?php } ?>
                						</td>
                                        <td width="300" class="prd-name left"><?php echo $product['name']; ?></td>
                                        
                                        <td class="quantity"><?php echo $product['quantity']; ?></td>
                                        <td width="148" class="price right">
                                        <?php 
                                        if($product['price'] >0) 
                                        {
                                       	  echo $product['price'];
                                        } else { 
                                        ?>
                                        Chưa có giá				                                        <?php } ?>
                                       
                                        </td>
                                        <td width="148" class="price right"><?php echo $product['total']; ?></td>
                                    </tr>
                                    <?php } ?>
                                                
                                                <tr class="bottom">
                                                    <td colspan="4" class="right">
                                                        <p class="fl-right total"><strong>Tổng cộng :</strong></p>
                                                    </td>
                                                    <td class="sub-total right"><?php echo $this->cart->getTotal();?></td>
                                                </tr>
                                            </tbody>
                                         </table>
                                    </div>
                                    <?php if($common_confirm) { ?>
                                    <div id="payment-method" style="display:none;"></div>
                                    <script type="text/javascript">
									$(function() {
										$.ajax({
											url: 'index.php?route=common/confirm',
											dataType: 'json',
											success: function(json) {
												if (json['redirect']) {
													location = json['redirect'];
												}	
																	
												if (json['output']) {
													$('#payment-method').html(json['output']);
													$('#button-confirm').click();
													$('#payment-method').html("");
												}
											}
										});	
									});	
                                    </script>
                                    <?php }
                                    ?>
                                  </div>
                                  <!--Delivery info-->
                                  <div class="w410 fl-left mgl30">
                                    <?php echo $info_payment_online;?>
                                    
                                  </div>
                                  <!--Delivery info-->
                                  
                                  <div class="clear"></div>
                                  <div class="form-submit top-gap-10">
                                     <a href="shopping-cart.php" class="link-btn back fl-left">Trở lại</a>
                                     <a onclick="paymentcomplete();return false;" class="btn big-button fl-right mgl10"><span class="arrow"></span>Đặt hàng Online</a>
                                 </div>
                                    
                                    
                                </div>
                                <!-- /product detail-->

                            </div>
                            <!-- / main-content  -->
                              
                            <!-- /end mid-content  -->
                            
                        </div>
     </div>  

<script type="text/javascript"><!--
$('select[name=\'shipping_zone_id\']').load('index.php?route=common/register/zone&country_id=230&zone_id=');
//--></script> 
<script type="text/javascript">
	function toggleDiv(otherAddress) {
	   $("#otherAddress").toggle();
	   if($("#isshipping").val()==0) {
	   		$("#isshipping").val(1);
	   } else {
			$("#isshipping").val(0);
	   }
	}
	function paymentcomplete()
	{
		var isVisible = $('#otherAddress').is(':visible');
		$('#shippingUserForm').submit();
		/*if(isVisible) {
			$('#shippingUserForm').submit();
		} else {
			
		}
		*/
		
	}
	
		
			
</script>
<?php echo $footer; ?>